﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Configuration;
using System.Data;

namespace MIT.Login
{
    public partial class SignUp : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void ButtonSignUp_Click1(object sender, EventArgs e)
        {
            string CS = ConfigurationManager.ConnectionStrings["DBCS"].ConnectionString;
            using (SqlConnection con = new SqlConnection(CS))
            {
                SqlCommand cmd = new SqlCommand("spAddUser", con);
                cmd.CommandType = System.Data.CommandType.StoredProcedure;

                cmd.Parameters.AddWithValue("@Name", TextBoxName.Text);
                cmd.Parameters.AddWithValue("@UserName", TextBoxUserName.Text);
                cmd.Parameters.AddWithValue("@DOB", TextBoxDOB.Text);
                cmd.Parameters.AddWithValue("@Division", DropDownListDivision.SelectedValue);
                cmd.Parameters.AddWithValue("@Position", DropDownListPosition.SelectedValue);
                cmd.Parameters.AddWithValue("@Email", TextBoxEmail.Text);
                cmd.Parameters.AddWithValue("@LogPass", TextBoxPass.Text);
                cmd.Parameters.AddWithValue("@Image", FileUploadProfilePic.FileBytes);



                con.Open();
                cmd.ExecuteNonQuery();

                LabelRegStatus.Text = "Registration Successful!";
                Response.Redirect("SignIn.aspx");

            }
        }


        protected void CalendarDOB_SelectionChanged(object sender, EventArgs e)
        {
            TextBoxDOB.Text = CalendarDOB.SelectedDate.ToShortDateString();
        }



    }
}